import request from '@/http/request'
const apiUrl = 'bf-bidding'

// -----------项目信息管理相关接口----------
export const projectInfoApi = {
  getProjectPageList: (param) => request.post(`/bf-bidding/project/getPageList`, param), // 项目分页列表
  getProjectInfo: (projectId) => request.get(`/bf-bidding/project/getInfo/${projectId}`), // 查项目详情
  getTaskCount: (projectId) => request.get(`/bf-bidding/project/getTaskCount?projectId=${projectId}`), // 统计任务
  getProjectFacilitiesPhasePlan: (projectId) => request.get(`/bf-bidding/project/projectFacilitiesPhasePlan?projectId=${projectId}`), // 项目设施阶段计划
  getProjectInfoFlow: (param) => request.post(`/bf-bidding/projectTask/getProjectInfoFlow`, param), // 项目详情里面获取流程信息
  getTenderActionApplyFlow: (tenderTaskId) => request.get(`/bf-bidding/tenderTask/getTenderActionApplyFlow?tenderTaskId=${tenderTaskId}`), // 获取招标任务信息
  getProjectTaskInfo: (projectTaskId) => request.get(`/bf-bidding/projectTask/getProjectTaskInfo?projectTaskId=${projectTaskId}`), // 获取项目任务详情
  getProjectInfoTaskList: (projectId) => request.get(`/bf-bidding/projectTask/getProjectInfoTaskList?projectId=${projectId}`), // 项目详情中的招标任务
  getAllotUsers: (projectTaskId) => request.get(`/bf-bidding/tenderTask/getAllotUsers?projectTaskId=${projectTaskId}`), // 通过项目任务编号获取可以分配的用户列表
  tenderTaskAllot: (param) => request.post(`/bf-bidding/tenderTask/allot`, param), // 将指定项目任务分配给指定用户
  getLocations: (type, code) => request.get(`/bf-assets/location/getLocations?type=${type}&code=${code}`,), // 将指定项目任务分配给指定用户
}

// -----------协同审批管理相关接口----------
export const collaborativeApprovalApi = {
  getTenderTaskApprovalPageList: (param) => request.post(`/bf-bidding/tenderTaskApproval/getPageList`, param), // 获取审批单分页列表
  getApplyInfo: (tenderTaskId) => request.get(`/bf-bidding/tenderTaskApproval/getApplyInfo?tenderTaskId=${tenderTaskId}`), // 获取比选申请详情
}


// ---------招标任务流程接口------------
export const processApi = {

  getTypeList: () => request.get(`${apiUrl}/projectTask/getTypeList`), // 招标项目类型列表
  /* 公共流程接口 */
  updateFlowConfig: (param) => request.post(`${apiUrl}/public/flow/updateFlowConfig`, param), // 更新流程配置
  getAllNodes: () => request.get(`${apiUrl}/public/flow/getAllNodes`), //获取所有节点信息
  getAllNodeActions: () => request.get(`${apiUrl}/public/flow/getAllNodeActions`), //获取所有节点行为信息
  removeNode: (param) => request.get(`${apiUrl}/public/flow/removeNode?nodeId=` + param), //删除节点
  addNode: (param) => request.post(`${apiUrl}/public/flow/addNode`, param), //新增节点
  getMainFlows: () => request.get(`${apiUrl}/public/flow/getMainFlows`), //获取公共流程信息
  getFlowDetail: (param) => request.get(`${apiUrl}/public/flow/getFlowDetail?flowPublicId=` + param), //获取公共流程配置信息
  getApplyWinNoticeInfo: (param) => request.get(`${apiUrl}/tenderTaskApproval/getApplyWinNoticeInfo?tenderTaskId=${param.tenderTaskId}&businessId=${param.businessId}`), //通知书详情
  saveApplyWinNotice: (param) => request.post(`${apiUrl}/tenderTaskApproval/saveApplyWinNotice`, param), //保存通知书
  saveAnnex: (param) => request.post(`${apiUrl}/tenderTaskApproval/saveAnnex`, param), //保存合同扫描件
  terminate: (param) => request.post(`${apiUrl}/tenderTask/terminate`, param), //q确认流标
  getHomeBoard: (param) => request.get(`${apiUrl}/tenderTask/index/board`,), //首页统计

  getAnnex: (param) => request.get(`${apiUrl}/tenderTaskApproval/getAnnex?tenderTaskId=${param.tenderTaskId}&businessId=${param.businessId}`), //获取合同扫描件详情

  /* 任务详情 */
  getManageDetailInfo: (param) => request.get(`${apiUrl}/tenderTask/info?tenderTaskId=` + param), //任务详情

  /* 招标任务流程接口 */
  //更新流程配置
  confirmTaskFlow: (param) => request.post(`${apiUrl}/task/flow/confirmTaskFlow`, param),
  //获取招标任务的流程配置信息
  getTaskFlow: (param) => request.get(`${apiUrl}/task/flow/getTaskFlow?tenderTaskId=${param.tenderTaskId}&tenderType=${param.tenderType}`),
  // 招标任务分页列表
  getPageList: (param) => request.post(`${apiUrl}/public/flow/getPageList`, param),
  // 统计看板
  getBoard: (param) => request.get(`${apiUrl}/public/flow/getBoard`),
  // 获取部门列表
  getDeptList: (param) => request.get(`${apiUrl}/projectTask/getDeptList`),

}


// --------- 台账管理 ---------

export const ledgerApi = {

  updateProjectLedger: (param) => request.post(`${apiUrl}/ledgerManagement/updateProjectLedger`, param), /* 修改台账 */
  addProjectLedger: (param) => request.post(`${apiUrl}/ledgerManagement/addProjectLedger`, param), /* x新增台账 */
  getProjectTaskLedgerVo: (param) => request.post(`${apiUrl}/ledgerManagement/getProjectTaskLedgerVo`, param), /* 台账内容查看 */
  getList: (param) => request.get(`${apiUrl}/ledgerManagement/getList`),/* 实时台账列表信息 */
  removeProjectLedger: (param) => request.get(`${apiUrl}/ledgerManagement/removeProjectLedger?ledgerId=` + param),/* 移除台账配置 */
  getConfigurationList: (param) => request.get(`${apiUrl}/ledgerManagement/getConfigurationList?ledgerId=` + param),/* 台账的表头 */
  getCommonConfigurationList: (param) => request.get(`${apiUrl}/ledgerManagement/getCommonConfigurationList`),/* 获取公共表头 */


}


// ----------合同管理-----------
export const contractApi = {
  getPageList: (param) => request.post(`${apiUrl}/task/contract/getPageList`, param),/* 获取分页列表 */
  getInfo: (param) => request.get(`${apiUrl}/task/contract/getInfo?tenderTaskId=` + param),/* 获取详情信息 */
  getFiles: (param) => request.get(`${apiUrl}/task/contract/getFiles?tenderTaskId=` + param),/* 获取附件信息 */
  getBill: (param) => request.get(`${apiUrl}/task/contract/getBill?tenderTaskId=` + param),/* 获取账单信息 */


}


// ------------- 招标任务管理 --------------
export const biddingTaskApi = {
  getBoard: (param) => request.get(`${apiUrl}/tenderTask/board`, param),/* 看板统计 */
  getAllotToList: (param) => request.get(`${apiUrl}/tenderTask/getAllotToList`, param),/* 待派发招标列表 */
  getAllotUsers: (param) => request.get(`${apiUrl}/tenderTask/getAllotUsers?projectTaskId=` + param),/* 通过项目任务编号获取可以分配的用户列表 */
  getDeptUserList: (param) => request.get(`${apiUrl}/tenderTask/getDeptUserList?isHide=` + param),/* 获取统计部门用户列表 */
  getInfo: (param) => request.get(`${apiUrl}/tenderTask/info?tenderTaskId=` + param),/* 通过招标项目编号查询招标任务详情信息 */
  getTenderActionApplyFlow: (param) => request.get(`${apiUrl}/tenderTask/getTenderActionApplyFlow?tenderTaskId=` + param),/* 获取招标任务信息 */
  getPageList: (param) => request.post(`${apiUrl}/tenderTask/getPageList`, param),/* 分页列表 */
  allot: (param) => request.post(`${apiUrl}/tenderTask/allot`, param),/* 将指定项目任务分配给指定用户 */

}



// ---------- 招标任务协同审批管理 ------------

export const approveApi = {

  getApplyContractInfo: (param) => request.get(`${apiUrl}/tenderTaskApproval/getApplyContractInfo?tenderTaskId=${param.tenderTaskId}&businessId=${param.businessId}`),/* 获取合同会审单详情 */
  saveApplyContract: (param) => request.post(`${apiUrl}/tenderTaskApproval/saveApplyContract`, param),/* 保存合同会审单 */


  getReferenceInfo: (param) => request.get(`${apiUrl}/tenderTaskApproval/getReferenceInfo?tenderTaskId=` + param),/* 获取推荐服务单位审批单 */
  // saveApplyContract: (param) => request.post(`${apiUrl}/tenderTaskApproval/saveApplyContract`,param),/* 保存推荐服务单位审批单 */

  getApplyResultInfo: (param) => request.get(`${apiUrl}/tenderTaskApproval/getApplyResultInfo?tenderTaskId=${param.tenderTaskId}&businessId=${param.businessId}`),/* 获取结果会审单详情 */
  saveApplyResult: (param) => request.post(`${apiUrl}/tenderTaskApproval/saveApplyResult`, param),/* 保存结果会审单详情 */

  getApplyInfo: (param) => request.get(`${apiUrl}/tenderTaskApproval/getApplyInfo?tenderTaskId=${param.tenderTaskId}&businessId=${param.businessId}`),/* 获取比选申请详情 */
  saveApply: (param) => request.post(`${apiUrl}/tenderTaskApproval/saveApply`, param),/* 保存比选会审单 */
}
